-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getters for private default Headers and authentications #8509
Conversation
Makes sense, follow the PR check list and regenerate the samples. Otherwise it won't build. I would recommend returning immutable copies of the collections in the getters to avoid the problems that you added as documentation. |
returning an immutable list for the authentications sounds like a good idea. |
Hmm are you sure this is the correct template? The |
so, I finally got round to doing this stuff. Thanks btw, I did mistakenly use the wrong template folder. |
I confirmed it with other generators and they wrap headers and authenticators in immutable maps too. |
This reverts commit ec60f60.
I would actually advocate for leaving the returned headermap mutable. For the Authentications it definitely makes sense to return them immutably since the authentications are defined in the spec and the generated code sort of enforces those by only respecting authentications on certain keys in the map from what I understand, but leaving the headermap mutable has the benefit that you can use the full dart collection api to mutate it if you want and not be constrained to only adding one header at a time via a function call. I don't really see any downside to that either... |
Fine by me |
CircleCI failure not related to this change. |
Broken master build fixed in #8581 |
Rationale for this is: At the moment I'm in a situation where code generation (or rather the scheme generation for our backend code) doesn't generate code that works with our backend, so I need to do one specific request by hand. I'd like to still use the same default headers and authentications that the Apiclient uses though.
This is a really minor change, so I thought I'd show you the code before talking. Submitting this as draft so I can do the build and sample generation later
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
,5.1.x
,6.0.x